<?php
	get_header();
?>
                                        
        <!--Body-->
        <div id="body">
            <div id="left_menu">
                <?php
                    wp_nav_menu(array('theme_location' => 'menu-2','fallback_cb' => 'alert_menu','container_class' => 'menu_items'));
                ?>
            </div>
            <div id="main_content">
                    <ul  class="product_block">
                        <?php
                            query_posts('posts_per_page=16');
                            if(have_posts()) : while(have_posts()) : the_post(); 
                        ?>
                        <li class="pr_items">
                        <?php 
                            $img = get_post_meta($post -> ID, "imagelink1",true);
                            $price = get_post_meta($post -> ID, "price",true);
                            $pricevn = get_post_meta($post -> ID, "pricevn",true);
                        ?>
                        <a href="<?php the_permalink();?>" class="pr_link">
                            <?php if ( has_post_thumbnail() ) {
                            	the_post_thumbnail('thumbnail', array('class' => 'thumb_img'));
                                }
                                else if($img != '') {
                                    echo '<img alt="thumbs" src=' . $img . ' class="thumb_img"/>';
                                }
                                else {
                                	echo '<img alt="thumbs" src="' . get_bloginfo( 'template_directory' ) . '/images/no_image.gif" class="thumb_img"/>';
                                }
                            ?>
                        </a>
                        </li>
                        <?php endwhile; wp_reset_query();?>
                            <p><?php next_posts_link(); ?></p>
                            <p><?php previous_posts_link(); ?></p>
                        <?php else: ?>
                            <h1>Sorry, There are no posts to display</h1>
                        <?php endif;  ?>
                    </ul>
                    <script>
                        $(document).ready(function() {
                            $(".thumb_img").each(function() {
                                $height = $(this).height();
                                if($height > 210) {
                                    $(this).css("margin-top","-20px");
                                };
                            })
                        });
                    </script>
            </div>
        </div>
<?php
	get_footer();
?>